package com.crm.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.crm.domain.entity.Dept;
import com.crm.domain.vo.DeptVo;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface DeptMapper extends BaseMapper<Dept> {


    List<DeptVo> list(String deptName, Integer status);

    @Select("select * from dept where dept_id = #{parentId}")
    Dept selectParent(Integer parentId);

    @Select("select * from dept where parent_id = #{id}")
    List<Dept> selectChidren(Integer id);

    DeptVo getDept(Integer deptId);

    @Select("select * from dept where parent_id != #{deptId} and dept_id != #{deptId}")
    List<DeptVo> excludeDept(Integer deptId);
}
